package com.xbq.oauth.validate.code;


import lombok.AllArgsConstructor;
import lombok.Data;

import java.awt.image.BufferedImage;
import java.time.LocalDateTime;

//图形验证码
@Data
public class ImageCode {

    private BufferedImage image;    //图片信息
    private String code;            //验证码
    private LocalDateTime expireTime;//过期时间


    public ImageCode(BufferedImage image,String code,LocalDateTime expireTime){
        this.image = image;
        this.code = code;
        this.expireTime = expireTime;
    }

    /**
     *
     * @param image
     * @param code
     * @param expireIn:过期间隔
     */
    public ImageCode(BufferedImage image,String code,int expireIn){
        this.image = image;
        this.code = code;
        this.expireTime = LocalDateTime.now().plusSeconds(expireIn);
    }
}
